
using AutoMapper;
using Domain.Models;
using IRepository;
using IServices;
using Microsoft.EntityFrameworkCore;
using Services.Base;
using System.Collections.Generic;
using System.Linq;

namespace Services
{
    public class AccountRoleService : BaseService<AccountRole>, IAccountRoleService
    {
        protected readonly IAccountRoleRepository accountRoleRepository;

        public AccountRoleService(IAccountRoleRepository accountRoleRepository, IMapper mapper) : base(mapper)
        {
            this.accountRoleRepository = accountRoleRepository;
            base.baseRepository = accountRoleRepository;
        }
        public IEnumerable<Role> QueryRole(int accountId)
        {
            var roles = accountRoleRepository.Queryable(x => x.AccountId == accountId)
                .Include(x => x.Role)
                .Select(x => x.Role);

            return roles;
        }
    }

}